import { TableOptionsType, TableColumnType, TableScrollType, TableCrudConfigType, TableCrudItemType } from '@/components/Table/types'

export const columns: TableColumnType[] = [
  {
    title: '项目名称',
    key: 'name',
    ellipsis: true,
    align: 'left'
  },
  {
    title: '描述',
    key: 'describe',
    edit: true
  },
  {
    title: '备注',
    key: 'remark',
    edit: true
  },
  {
    title: '更新时间',
    key: 'updateTime',
    edit: true
  },
  {
    title: '状态',
    key: 'status',
    width: 70, // 设置列宽
    render: (status: any) => {
      if (status == '1') {
        return `<a-tag color="pink">成功</a-tag>`
      } else if (status == '2') {
        return `<a-tag color="red">失败</a-tag>`
      } else if (status == '3') {
        return `<a-tag color="orange">已上线</a-tag>`
      } else {
        return `<a-tag color="green">运行中</a-tag>`
      }
    }
  },
  {
    title: '发出单位',
    key: 'sendUnit',
    edit: true
  },
  {
    title: '接收单位',
    key: 'receiveUnit',
    edit: true
  },
  {
    title: '操作',
    key: 'button',
    width: 160,
    align: 'center',
    fixed: 'right',
    group: [
      {
        type: 'danger',
        text: '删除',
        key: 'remove',
        popconfirm: true
      },

      {
        type: 'default',
        text: '添加',
        key: 'add',
        popconfirm: true
      }
    ]
  }
]

export const options: TableOptionsType = {
  addBtn: true, //显示添加按钮
  removeBtn: true, //显示批量删除按钮
  customize: true, //自定义刷新 等操作栏
  index: true, // 是否显示序号
  border: false, //是否显示边框
  loading: false, //页面是否加载中	boolean |object	false
  defaultExpandAllRows: false, //初始时，是否展开所有行	boolean	false
  defaultExpandedRowKeys: [], //默认展开的行	string[]
  pagination: false, //分页器
  indentSize: 15, //子集缩进
  rowSelection: true //是否显示多选栏
}

export const scroll: TableScrollType = {
  x: 1500,
  y: 700
}

export const crudConfig: TableCrudConfigType = {
  labelAlignh: 'right', // 'right'  'left' | 'right'
  labelCol: { style: { width: '80px' } }, // { style: { width: '80px' } }  输入框左边文字的宽度
  layout: 'horizontal' // 'horizontal'|'vertical'|'inline'  文字在输入框的左边 | 上边}
}
export const crudAddItemConfig: TableCrudItemType[] = [
  {
    type: 'a-input',
    key: 'name',
    label: '项目名称',
    eventName: 'blur'
  },
  {
    type: 'a-input',
    key: 'describe',
    label: '描述',
    eventName: 'blur'
  },
  {
    type: 'a-input',
    key: 'remark',
    label: '备注',
    eventName: 'blur'
  },
  {
    type: 'a-input',
    key: 'updateTime',
    label: '更新时间'
  },
  {
    type: 'a-input',
    key: 'status',
    label: '状态'
  },
  {
    type: 'a-select',
    key: 'sendUnit',
    label: '发出单位',
    eventName: 'change',
    options: [
      { label: '强盛集团', value: 'qsjt' },
      { label: '建工集团', value: 'jgjt' },
      { label: '宏伟集团', value: 'hwjt' }
    ]
  },
  {
    type: 'a-input',
    key: 'receiveUnit',
    label: '接收单位'
  },
  {
    type: 'a-radio-group',
    key: 'sports',
    label: '运动',
    disabled: false,
    options: [
      { value: 1, label: '篮球' },
      { value: 2, label: '足球' },
      { value: 3, label: '羽毛球' }
    ]
  },
  {
    type: 'a-checkbox-group',
    key: 'foods',
    label: '食物',
    span: 12,
    options: [
      { value: 1, label: '水饺' },
      { value: 2, label: '面条' },
      { value: 3, label: '羽毛球' }
    ]
  },
  {
    type: 'a-textarea',
    key: 'des',
    span: 24,
    label: '描述'
  }
]

export const crudEditConfig: TableCrudItemType[] = [
  {
    type: 'a-input',
    key: 'name',
    label: '项目名称',
    eventName: 'blur',
    disabled: true
  },
  {
    type: 'a-input',
    key: 'describe',
    label: '描述',
    eventName: 'blur'
  },
  {
    type: 'a-input',
    key: 'remark',
    label: '备注',
    eventName: 'blur'
  },
  {
    type: 'a-input',
    key: 'updateTime',
    label: '更新时间'
  },
  {
    type: 'a-input',
    key: 'status',
    label: '状态'
  },
  {
    type: 'a-select',
    key: 'sendUnit',
    label: '发出单位',
    eventName: 'change',
    disabled: true,
    options: [
      { label: '强盛集团', value: 'qsjt' },
      { label: '建工集团', value: 'jgjt' },
      { label: '宏伟集团', value: 'hwjt' }
    ]
  },
  {
    type: 'a-input',
    key: 'receiveUnit',
    label: '接收单位'
  },
  {
    type: 'a-radio-group',
    key: 'sports',
    label: '运动',
    disabled: true,
    options: [
      { value: 1, label: '篮球' },
      { value: 2, label: '足球' },
      { value: 3, label: '羽毛球' }
    ]
  },
  {
    type: 'a-checkbox-group',
    key: 'foods',
    label: '食物',
    span: 12,
    options: [
      { value: 1, label: '水饺' },
      { value: 2, label: '面条' },
      { value: 3, label: '羽毛球' }
    ]
  },
  {
    type: 'a-textarea',
    key: 'des',
    span: 24,
    label: '描述'
  }
]

// https://2x.antdv.com/components/overview-cn/
